home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2863 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.3 KB

  1. Path: prairienet.org!sjmccaug
  2. From: sjmccaug@prairienet.org (Scott J. McCaughrin)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: char vs. unsigned char  ???
  5. Date: 20 Jan 1996 03:28:07 GMT
  6. Organization: University of Illinois at Urbana
  7. Message-ID: <4dpng7$4lj@vixen.cso.uiuc.edu>
  8. References: <DLGEKq.1zq@avalon.chinalake.navy.mil>
  9. Reply-To: sjmccaug@prairienet.org (Scott J. McCaughrin)
  10. NNTP-Posting-Host: firefly.prairienet.org
  11.  
  12.  
  13. In a previous article, charles_harvey@imdgw.chinalake.navy.mil (sean harvey) says:
  14.  
  15. >I recently encorporated some functions from another program compiled and 
  16. >linked under an older version (Microsoft C version 6.0) into my program 
  17. >(MSVC 7.0).
  18. >
  19. >The alien code would not compile for me due, I guess to more rigorous 
  20. >type-checking.
  21. >
  22. >He used a lot of unsigned char strings that generated compile errors on 
  23. >calls to functions strlen, strcat and sprintf.
  24. >
  25. >So I changed his types to char and compiled cleanly but the program 
  26. >crashes and I think it may be due to the changes.
  27. >
  28.  In its simplest incarnation, 'unsigned char' uses all 8 bits of a byte,
  29.  while 'signed char' allows for 7-bit, 2's-complement values. One advantage
  30.  of the latter is to let EOF (= -1 in UNIX) be a short int (= unsigned char)
  31.  in some systems. So one way to track your problem is to see where anything
  32.  other than an unsigned char is used numerically.
  33.  
  34.  -- Scott McC.
  35.  
  36.